#pragma once

#include "QSSystems.h"
#include "QSCommand.h"

namespace QS
{
	class GameSystemImpl : public GameSystem, public EventListener
	{
	public:
		GameSystemImpl(Engine* e) : GameSystem(e){}
		virtual ~GameSystemImpl(){}

		virtual void initialize();
		virtual void shutdown();
		virtual void update(){}

		virtual void addCommand(const Command& cmd);
		virtual void executeCommand(const String& command);
		virtual void bind(Key::Enum key, const String& command);

		virtual void processEvent(const Event& e);
	private:
		void cmdPrint(const CommandArgs& args);
		void cmdQuit(const CommandArgs& args);
		void cmdBind(const CommandArgs& args);
		void print(const String& text);
		Command* findCommand(const String& name);
		void clearCommands();

		typedef std::vector<Command> CommandList;
		CommandList mCommands;

		typedef std::map<Key::Enum, String> KeyBindings;
		KeyBindings mBindings;
	};
}